package ah.szxy.service;

import ah.szxy.model.User;
import ah.szxy.sink.Sink;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Service;

@Service
public class ReceiveService {

    @Autowired
    private Sink sink ;

    @StreamListener("input1")
    public void input1Listener(String msg){
        System.out.println("input1 收到消息:"+msg);
    }


    @StreamListener("input2")
    public void input2Listener(String msg){

        System.out.println("input2 收到消息:"+msg);

    }


    @StreamListener("input3") // 监听对象
    public void input3Listener(@Payload  User msg){
        System.out.println("input3 收到消息:"+msg);
    }


    @StreamListener("input4") // 事务消息
    public void input4Listener(Object msg){
        System.out.println("input4 收到事务消息:"+msg);
    }
}
